import request from '@/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/civil-user/list',
    method: 'get',
    params: {
      ...params,
      current,
      size
    }
  });
};
export const remove = (ids) => {
  return request({
    url: '/api/civil-user/remove',
    method: 'post',
    params: {
      ids
    }
  });
};

export const add = (row) => {
  return request({
    url: '/api/civil-user/submit',
    method: 'post',
    data: row
  });
};

export const update = (row) => {
  return request({
    url: '/api/civil-user/update',
    method: 'post',
    data: row
  });
};

export const grant = (userIds, roleIds) => {
  return request({
    url: '/api/civil-user/grant',
    method: 'post',
    params: {
      userIds,
      roleIds
    }
  });
};

export const getUser = (id) => {
  return request({
    url: '/api/civil-user/detail',
    method: 'get',
    params: {
      id
    }
  });
};

export const getUserInfo = () => {
  return request({
    url: '/api/civil-user/info',
    method: 'get'
  });
};

export const resetPassword = (userIds) => {
  return request({
    url: '/api/civil-user/reset-password',
    method: 'post',
    params: {
      userIds
    }
  });
};

export const updatePassword = (oldPassword, newPassword, newPassword1) => {
  return request({
    url: '/api/civil-user/update-password',
    method: 'post',
    params: {
      oldPassword,
      newPassword,
      newPassword1
    }
  });
};

